package com.cambright.mixpaint
{
	public class Graphic extends Canvas
	{
		private var _graphicChanged:Boolean = true;
		
		private var _color:uint = 0;
		public function get color():uint
		{
			return _color;
		}
		public function set color(value:uint):void
		{
			if(value == _color) return;
			_color = value;
			_graphicChanged = true;
		}
		
		private var _alpha:Number = 1.0;
		override public function get alpha():Number
		{
			return _alpha;
		}
		override public function set alpha(value:Number):void
		{
			if(value < 0.0) value = 0.0;
			else if(value > 1.0) value = 1.0;
			if(value == _alpha) return;
			_alpha = value;
			_graphicChanged = true;
		}
		
		override protected function get isChanged():Boolean
		{
			var isChanged:Boolean = super.isChanged;
			isChanged ||= _graphicChanged;
			return isChanged;
		}
		
		override protected function finish():void
		{
			super.finish();
			_graphicChanged = false;
		}
	}
}